package cn.kevinking.common.pojo;

import cn.kevinking.common.constant.HttpConsts;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * common return entity
 *
 * @author kevinking
 * @since 17 Nov 2024
 * @param <T> type of data object
 */
@Data
@Accessors(fluent = true)
public class ResultVO<T> {
	private Integer code;
	private String msg;
	private T data;

	public static <T> ResultVO<?> ok(T data) {
		return new ResultVO<>().code(HttpConsts.OK).msg(HttpConsts.OK_MSG).data(data);
	}

	public static ResultVO<?> error() {
		return new ResultVO<>().code(HttpConsts.INTERNAL_SERVER_ERROR).msg(HttpConsts.ERR_MSG);
	}
}
